<?php
App::uses('AppModel', 'Model');
/**
 * Movie Model
 *
 * @property Actor $Actor
 * @property Director $Director
 * @property Keyword $Keyword
 */
class Movie extends AppModel {

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	public $validate = array(
    'rating' => array(
			array(
			'rule'    => array('comparison', '>=', 0),
			'message' => 'Must be at least 0.'),
			array(
			'rule'    => array('comparison', '<=', 10),
			'message' => 'Must be lower or equal to 10.')
		)
    );
/**
 * hasAndBelongsToMany associations
 *
 * @var array
 */
	public $hasAndBelongsToMany = array(
		'Movies'=>array(
			'className' => 'Movie', 
			'joinTable' => 'movies_movies', 
			'foreignKey' => 'movie_id', 
			'associationForeignKey' => 'submovie_id',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
			'deleteQuery' => '',
			'insertQuery' => ''
		),
		'Actor' => array(
			'className' => 'Actor',
			'joinTable' => 'actors_movies',
			'foreignKey' => 'movie_id',
			'associationForeignKey' => 'actor_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
			'deleteQuery' => '',
			'insertQuery' => ''
		),
		'Director' => array(
			'className' => 'Director',
			'joinTable' => 'directors_movies',
			'foreignKey' => 'movie_id',
			'associationForeignKey' => 'director_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
			'deleteQuery' => '',
			'insertQuery' => ''
		),
		'Keyword' => array(
			'className' => 'Keyword',
			'joinTable' => 'keywords_movies',
			'foreignKey' => 'movie_id',
			'associationForeignKey' => 'keyword_id',
			'unique' => 'keepExisting',
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
			'deleteQuery' => '',
			'insertQuery' => ''
		)
	);

}
